<?php
namespace app\api\validate;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/21 0021
 * Time: 14:35
 */
class LoginValidate extends BaseValidate
{
    protected $rule = [
        'tel' => ['require','/^1[34578]\d{9}$/','unique:user'],
        'username' => 'require|length:5,15',
        'password' => 'alphaNum|require|length:5,15',
        'verify' => 'require|number',
        'openid' => 'require'
    ];
    protected $message = [
        'tel.require' => '手机号码必填',
        'tel.unique' => '手机号码已被注册',
        'tel' => '手机格式不正确',
        'username.require'=>'用户名不能为空',
        'username.length'=>'用户名长度为5-15字符',
        'password.alphaNum' => '必须为字母与数字',
        'password.require' => '密码不能为空',
        'password.length' => '密码长度只能在5-15之间',
        'verify.require' => '验证码必填',
        'verify.number'=> '验证码为纯数字',
        'openid.require'=> 'openid不能为空'
    ];
    protected $scene = [
        'login' => ['tel'=>['/^1[34578]\d{9}$/','require'],'password'],
        'tel' => ['tel'=>['/^1[34578]\d{9}$/','require']],
        'third_bind' => ['openid'],
        'registe' => ['tel','password','verify'],
        'tv' =>['tel'=>['/^1[34578]\d{9}$/','require'],'verify'],
    ];
}